<template>
    <IModal v-model="defaultValue" :loading="loading" :width="400" title="对接设置">
        <Form :model="data" :label-width="100" :rules="ruleValidate" ref="formCreate">
            <FormItem label="配合员" prop="user_id">
                <RemoteSelect url="common/select/user" v-model="data.user_id"></RemoteSelect>
            </FormItem>
        </Form>
        <div slot="footer">
            <Button type="primary" icon="ios-add" @click="submit('formCreate')">提交</Button>
            <Button type="warning" icon="md-log-out" @click="defaultValue = false;">返回</Button>
        </div>
    </IModal>
</template>

<script>
    import IForm from "../../../components/content/form";
    import contentDrawer from "../../../mixins/contentDrawer";
    import IModal from "../../../components/content/modal";
    import RemoteSelect from "../../../components/form/remoteSelect";

    export default {
        name: "print",
        mixins: [contentDrawer],
        components: {RemoteSelect, IForm, IModal},
        data() {
            return {
                data: {},
                ruleValidate: {
                    user_id: [{required: true, message: '分配人员必须选择!'}]
                }
            }
        },
        methods: {
            submit(data) {
                this.validate(data).then(() => {
                    this.loading = true;
                    this.$http.put(`order/picking/${this.props.id}`, this.data).then((data) => {
                        this.defaultValue = false;
                    }).finally(() => {
                        this.loading = false;
                    });
                });
            }
        }
    }
</script>

<style scoped>

</style>
